﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace Skywave.Security
{
    [DataContract]
    public enum PolicyInterfaceTypes
    {
        [EnumMember]
        Folder = 0,
        [EnumMember]
        YesNo = 1,
        [EnumMember]
        EnableDisable = 2,
        [EnumMember]
        VisibleHidden = 3,
        [EnumMember]
        List = 4,
        [EnumMember]
        Custom = -1
    }
    [DataContract]
    public enum PolicyValueTypes
    {
        [EnumMember]
        SingleValue = 0,
        [EnumMember]
        MultipleValues = 1,
        [EnumMember]
        NoValue = -1
    }
    [DataContract]
    public enum PolicyValueReflectionType
    {
        [EnumMember]
        Int = 0,
        [EnumMember]
        String = 1
    }
    [DataContract]
    public enum PolicyTargetTypes
    {
        [EnumMember]
        Application = 0,
        [EnumMember]
        Archive = 1
    }
    [DataContract(IsReference = true, Namespace = "http://www.masoftco.ir/MA")]
    public class PolicyDescriptor
    {
        [DataMember]
        public int PolicyId { get; set; }
        [DataMember]
        public int IssuerId { get; set; }
        [DataMember]
        public string IssuerUniqueId { get; set; }
        [DataMember()]
        public string Name { get; set; }
        [DataMember()]
        public string Text { get; set; }
        [DataMember()]
        public string Description { get; set; }
        [DataMember()]
        public string DefaultValue { get; set; }
        [DataMember()]
        public PolicyInterfaceTypes InterfaceType { get; set; }
        [DataMember()]
        public PolicyValueTypes ValueType { get; set; }
        [DataMember]
        public PolicyValueReflectionType ReflectionType { get; set; }
        [DataMember]
        public PolicyTargetTypes TargetType { get; set; }
        [DataMember()]
        public PolicyDescriptor Parent { get; set; }

        private List<PolicyDescriptor> mChilds = new List<PolicyDescriptor>();

        [DataMember]
        public List<PolicyDescriptor> Childs
        {
            get { return mChilds; }
            set { mChilds = value; }
        }
    }
}
